<script setup lang="ts">
import { ref, onMounted, defineProps, shallowRef } from 'vue'
import * as echarts from 'echarts'
// 接收父组件传递的option
const { option } = defineProps(['option'])
// 定义ref数据获取DOM节点
const mycharts = shallowRef()
let charts = shallowRef({})
onMounted(() => {
    // console.log(mycharts.value)
    charts.value = echarts.init(mycharts.value)
    charts.value.setOption(option)
})
defineExpose({
    charts
})
</script>

<template>
    <div class="mycharts" ref="mycharts"></div>
</template>

<style lang="scss" scoped>
.mycharts {
    width: 100%;
    height: 100%;
}
</style>
